package com.example.spindrift.service;

import com.example.spindrift.dao.SysRoleMapper;
import com.example.spindrift.models.SysRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleService {
    @Autowired
    SysRoleMapper roleMapper;

    public List<SysRole> getAllRole(){
        return roleMapper.getAllRole();
    }
    public List<SysRole> getRoleByUserId(Integer userId){
        return roleMapper.getRoleByUserId(userId);
    }
    public List<SysRole> searchRole(String keyword){
        return roleMapper.searchRole(keyword);
    }
    public SysRole getRoleById(Integer roleId){
        return roleMapper.getRoleById(roleId);
    }

    public Integer insertRole(SysRole role){
        return roleMapper.insertRole(role);
    }
    public Integer updateRole(SysRole role){
        return roleMapper.updateRole(role);
    }
    public Integer deleteRole(Integer roleId){
        return roleMapper.deleteRole(roleId);
    }
}
